<template>
  <el-image
    :style="`width: ${widthItem}; height: ${heightItem}`"
    :preview-src-list="[modelValue + imagevalue]"
    :src="modelValue + imagevalue"
    fit="contain"
  />
</template>

<script>
export default {
  name: 'KImage',
  inheritAttrs: false,
  props: {
    imagevalue: { // 选中的选项标识
      type: String,
      default: ''
    },
    widthItem: { // 选中的选项标识
      type: String,
      default: '110px'
    },
    heightItem: { // 选中的选项标识
      type: String,
      default: '80px'
    },
    /**
     * 0:默认半路径，1：全路径
     */
    pathType:{
      type: [String,Number],
      default: '0'
    }
  },
  watch:{
    pathType(val){
        if(val == '0'){
          this.modelValue=this.$store.state.user.imagePath
        }else{
          this.modelValue=''
        }
    }
  },
  data() {
    return {
      modelValue: ''
    }
  }
}
</script>

<style lang="scss">  //不要加scoped
$defaultColor:#F8F7FB;
$select-borderColor-focus: #F8F7FB;
$select-optionFontColor: #3b425d;
.kSelect{
  position: relative;
  font-size: 14px;
  display:inline-block;
  ::v-deep .image-slot {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background: #f5f7fa;
    color: #909399;
    font-size: 40px;
  }
}
</style>
